var appStatus = [
    {
        name:"simpleConfig",
        url:"/simple",
        templateUrl:"html/simple/simple-config.html",
        controller:"simpleConfigCtrl",
        label:"首页"
    },
    {
        name:"detail",
        url:"/detail",
        params:{config:null},
        templateUrl:"html/simple/detail.html",
        controller:"detailCtrl",
        label:""
    },
    {
        name:"singleTask",
        url:"/singleTask",
        params:{config:null},
        templateUrl:"html/task/singleTask.html",
        controller:"singleTaskCtrl",
        label:""
    },
    {
        name: "quartz",
        url:"/quartzTask",
        params:{config:null},
        templateUrl:"html/task/quartzTask.html",
        controller:"quartzTaskCtrl"
    }, {

        name: "result",
        url:"/taskResult",
        params:{config:null},
        templateUrl:"html/task/taskResult.html",
        controller:"taskResultCtrl"
    },

/*    {
        name:"create",
        url:"/create",
        templateUrl:"html/createpagehtml/create-config.html",
        controller:"createConfigCtrl",
        label:"js生成页面的配置"
    },*/
   /* {
        name:"task",
        url:"/task",
        templateUrl:"html/task/crawler-task.html",
        controller:"crawlerTaskCtrl",
        label:"爬虫任务页面"
    },*/
    {
        name:"logger",
        url:"/logger",
        params:{config:null},
        templateUrl:"html/logger/logger-analysis.html",
        controller:"loggerCtrl",
        label:"日志分析页面"
    },
    {
        name:"logger-charts",
        url:"/loggerCharts",
        params:{config:null},
        templateUrl:"html/logger/logger-echarts.html",
        controller:"loggerEchartsCtrl",
        label:"日志查看"
    },
    {
        name:"dataType",
        url:"/dataType",
        params:{config:null},
        templateUrl:"html/task/dataType.html",
        controller:"dataTypeCtrl",
        label:"创建索引"
    },
    {
        name:"format",
        url:"/dataFormat",
        params:{config:null},
        templateUrl:"html/task/dataFormat.html",
        controller:"dataFormatCtrl",
        label:""
    }

];
angular.module("crawlerApp",["ui.router"]).config(function($locationProvider,$urlRouterProvider,$stateProvider){
     for(var i in appStatus){
         $stateProvider.state(appStatus[i])
     }
     $urlRouterProvider.when("","simple");//默认打开的视图
}).controller("indexCtrl",function($scope,$state,$q,menuService,$rootScope){
    console.log("indexCtrl");
    $rootScope.menus=menuService.getBasicMenu("simple").$$state.value.initMenu;
    $scope.sideMenuCode = "simpleConfig";
    $scope.clickBack = function(){
        $rootScope.menus=menuService.getBasicMenu("simple").$$state.value.initMenu;
        //$scope.sideMenuCode = "simpleConfig";
        //$state.go(menu.code,{config: $rootScope.data});
        $scope.clickSideMenu($rootScope.menus[0]);
    };
    $scope.clickSideMenu = function(menu){

        $scope.sideMenuCode = menu.code;
        $state.go(menu.code,{config: $rootScope.data})
    };

});